package com.wqm.step.pojo;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name = "i_idcard")
public class IDCard {

	// uuid主键
	@Id
	@GenericGenerator(strategy = "uuid", name = "myuuid")
	@GeneratedValue(generator = "myuuid")
	private String id;
	
	// 身份证号
	private String cardNum;

	// 关联用户表
	@OneToOne(targetEntity = User.class)
	@JoinColumn(name = "c_user_id")// 指定外键名称
	@Cascade(CascadeType.SAVE_UPDATE)// 级联配置在这边，可以通过身份证号删除用户，但是不能通过用户(客户)删除删除身份证号
	private User user;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getCardNum() {
		return cardNum;
	}

	public void setCardNum(String cardNum) {
		this.cardNum = cardNum;
	}

	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

}
